# Which compiler
CC = gcc

# Options
CFLAGS = `pkg-config --cflags --libs gtk+-2.0`

OBJ = main.o callbacks.o interface.o
LIB = libconv.so libdic.so

all: $(OBJ) $(LIB)
	$(CC) $(CFLAGS)-o app $(OBJ) -L. -lconv -ldic -g
	rm *.o

main.o: include/interface.h
	$(CC) $(CFLAGS)-c src/main.c -g

libconv.so : convert.o
	$(CC) -fPIC -shared $^ -o $@

libdic.so : DicManager.o TrieTree.o
	$(CC) -fPIC -shared $^ -o $@

interface.o: include/interface.h src/interface.c
	$(CC) $(CFLAGS)-c  src/interface.c -g

callbacks.o: include/callbacks.h src/callbacks.c
	$(CC) $(CFLAGS)-c  src/callbacks.c -g
 
convert.o: include/convert.h src/convert.c
	$(CC) $(CFLAGS)-c src/convert.c -g

DicManager.o: include/DicManager.h src/DicManager.c
	$(CC) $(CFLAGS)-c src/DicManager.c -g

TrieTree.o: include/TrieTree.h src/TrieTree.c
	$(CC) $(CFLAGS)-c src/TrieTree.c -g


clean:
	rm -f app *.o *.so
